From 676f46c8b71af74e90473d52a95442e1448e6a16 Mon Sep 17 00:00:00 2001 From: "gm281@boulderdash.cl.cam.ac.uk" Date: Fri, 6 Aug 2004 10:47:56 +0000 Subject: [PATCH] bitkeeper revision 1.1156 (411361dclImK_wtDjHbbaA9eclPocg) Polishing up the warping mechanism in bvt --- xen/common/sched_bvt.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/xen/common/sched_bvt.c b/xen/common/sched_bvt.c index 9f4278ea93..e4ee214b54 100644 --- a/xen/common/sched_bvt.c +++ b/xen/common/sched_bvt.c @@ -111,7 +111,6 @@ static void warp_timer_fn(unsigned long pointer) /* set unwarp timer */ inf->unwarp_timer.expires = NOW() + inf->warpu; - rem_ac_timer(&inf->unwarp_timer); add_ac_timer(&inf->unwarp_timer); spin_unlock_irqrestore(&CPU_INFO(inf->domain->processor)->run_lock, flags); @@ -362,14 +361,23 @@ int bvt_adjdom(struct domain *p, struct bvt_dom_info *inf = BVT_INFO(p); - DPRINTK("Get domain %u bvt mcu_adv=%u, warpback=%d, warpvalue=%d" + DPRINTK("Get domain %u bvt mcu_adv=%u, warpback=%d, warpvalue=%d, " "warpl=%lld, warpu=%lld\n", p->domain, inf->mcu_advance, inf->warpback, inf->warp_value, inf->warpl, inf->warpu); /* Sanity -- this can avoid divide-by-zero. */ if ( mcu_adv == 0 ) + { + printk("Mcu advance must not be set to 0 (domain %d)\n",p->domain); + return -EINVAL; + } + else if ( warpl < 0 || warpu < 0) + { + printk("Warp limits must be >= 0 (domain %d)\n", p->domain); return -EINVAL; + } + spin_lock_irqsave(&CPU_INFO(p->processor)->run_lock, flags); inf->mcu_advance = mcu_adv; @@ -377,14 +385,20 @@ int bvt_adjdom(struct domain *p, /* The warp should be the same as warpback */ inf->warp = warpback; inf->warp_value = warpvalue; - inf->warpl = warpl; - inf->warpu = warpu; - - DPRINTK("Get domain %u bvt mcu_adv=%u, warpback=%d, warpvalue=%d" - "warpl=%lld, warpu=%lld, values(%lld, %lld)\n", + inf->warpl = MILLISECS(warpl); + inf->warpu = MILLISECS(warpu); + + /* If the unwarp timer set up it needs to be removed */ + rem_ac_timer(&inf->unwarp_timer); + /* If we stop warping the warp timer needs to be removed */ + if(!warpback) + rem_ac_timer(&inf->warp_timer); + + DPRINTK("Get domain %u bvt mcu_adv=%u, warpback=%d, warpvalue=%d, " + "warpl=%lld, warpu=%lld\n", p->domain, inf->mcu_advance, inf->warpback, inf->warp_value, - inf->warpl, inf->warpu, warpl, warpu); - + inf->warpl, inf->warpu); + spin_unlock_irqrestore(&CPU_INFO(p->processor)->run_lock, flags); } else if ( cmd->direction == SCHED_INFO_GET ) -- 2.30.2